<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>日志系列一之commons-logging | Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="简介　　做过java服务端开发的程序员都会遇到日志记录的问题，目前，各个框架采用的日志组件都不一样，比如spring core、spring jdbc等核心组件采用的就是commons-logging日志框架。而可以与spring集成的周边产品，如mybatis、dubbo等则通过提供配置选项实现不同日志框架的接入。同时，spring自家的产品spring boot默认采用的日志框架则为logba">
<meta property="og:type" content="article">
<meta property="og:title" content="日志系列一之commons-logging">
<meta property="og:url" content="http://yoursite.com/2015/12/15/log/1.日志系列之commons-logging/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="简介　　做过java服务端开发的程序员都会遇到日志记录的问题，目前，各个框架采用的日志组件都不一样，比如spring core、spring jdbc等核心组件采用的就是commons-logging日志框架。而可以与spring集成的周边产品，如mybatis、dubbo等则通过提供配置选项实现不同日志框架的接入。同时，spring自家的产品spring boot默认采用的日志框架则为logba">
<meta property="og:image" content="http://yoursite.com/images/commons-logging-log接口.jpg">
<meta property="og:updated_time" content="2016-01-29T17:47:36.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="日志系列一之commons-logging">
<meta name="twitter:description" content="简介　　做过java服务端开发的程序员都会遇到日志记录的问题，目前，各个框架采用的日志组件都不一样，比如spring core、spring jdbc等核心组件采用的就是commons-logging日志框架。而可以与spring集成的周边产品，如mybatis、dubbo等则通过提供配置选项实现不同日志框架的接入。同时，spring自家的产品spring boot默认采用的日志框架则为logba">
  
    <link rel="alternative" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  

</head>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-log/1.日志系列之commons-logging" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/12/15/log/1.日志系列之commons-logging/" class="article-date">
  <time datetime="2015-12-14T17:00:01.000Z" itemprop="datePublished">2015-12-15</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/log/">log</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      日志系列一之commons-logging
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="u7B80_u4ECB"><a href="#u7B80_u4ECB" class="headerlink" title="简介"></a>简介</h2><p>　　做过java服务端开发的程序员都会遇到日志记录的问题，目前，各个框架采用的日志组件都不一样，比如spring core、spring jdbc等核心组件采用的就是commons-logging日志框架。而可以与spring集成的周边产品，如mybatis、dubbo等则通过提供配置选项实现不同日志框架的接入。同时，spring自家的产品spring boot默认采用的日志框架则为logback，当然，也支持log4j等其他的日志框架。<br>　　那么问题来了，当这些组件都被某一个服务同时使用的时候，他们是如何协同工作的呢？下面我将通过一系列文章，带领大家一一探究不同日志框架的原理性问题。本篇文章将主要介绍commons-logging的使用方法和实现机制</p>
<h2 id="u4F7F_u7528_u793A_u4F8B"><a href="#u4F7F_u7528_u793A_u4F8B" class="headerlink" title="使用示例"></a>使用示例</h2><p>　　首先在pom.xml中引入jar包<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">dependency</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">groupId</span>&gt;</span>commons-logging<span class="tag">&lt;/<span class="title">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">artifactId</span>&gt;</span>commons-logging<span class="tag">&lt;/<span class="title">artifactId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">version</span>&gt;</span>1.2<span class="tag">&lt;/<span class="title">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="title">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>　　先直接添加测试类<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Demo</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> Log log = LogFactory.getLog(Demo.class);</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span></span>&#123;</span><br><span class="line">        System.out.println(log);</span><br><span class="line">        log.trace(<span class="string">"trace信息"</span>);</span><br><span class="line">        log.debug(<span class="string">"debug信息"</span>);</span><br><span class="line">        log.info(<span class="string">"info信息"</span>);</span><br><span class="line">        log.warn(<span class="string">"warn信息"</span>);</span><br><span class="line">        log.error(<span class="string">"error信息"</span>);</span><br><span class="line">        log.fatal(<span class="string">"fatal信息"</span>);</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>　　运行后，打印信息如下。注意，此时没有添加commons-logging的配置文件<br>org.apache.commons.logging.impl.Jdk14Logger@6688cf9e<br>十二月 15, 2015 10:55:21 上午 Demo main<br>INFO: info信息<br>十二月 15, 2015 10:55:21 上午 Demo main<br>WARNING: warn信息<br>十二月 15, 2015 10:55:21 上午 Demo main<br>SEVERE: error信息<br>十二月 15, 2015 10:55:21 上午 Demo main<br>SEVERE: fatal信息</p>
<p>　　通过日志信息，我们可以看出，此时Log实例为org.apache.commons.logging.impl.Jdk14Logger，并没有输出trace和debug级别的信息。<br>　　关于为什么没出输出trace和debug的问题，与jdk提供的日志组件有关，jdk的日志组件默认的级别为INFO，即使在代码中调用((Jdk14Logger) log).getLogger().setLevel(java.util.logging.Level.FINEST);，也没有效果。但如果设置为：Level.WARNING，则产生效果，输出warn、error和fatal信息。进入源码可以发现，log.trace(“trace信息”)方法调用了Jdk14Logger.log(Level.FINEST, String.valueOf(message), null)方法。<br>　　commons-logging采用Jdk14Logger的机制原理，我将进入源码为大家解答。</p>
<h2 id="LOG_u63A5_u53E3"><a href="#LOG_u63A5_u53E3" class="headerlink" title="LOG接口"></a>LOG接口</h2><p>　　在commons-logging中，org.apache.commons.logging.Log作为一个接口，有如下图红框内所示的几个实现。在测试示例中为什么会选择org.apache.commons.logging.impl.Jdk14Logger呢！下面我们进入LogFactory.getLog方法一探究竟！<br><img src="/images/commons-logging-log接口.jpg" alt="commons-logging-log接口.jpg"><br>　　程序在调用LogFactory.getLog方法后，最终会执行到方法getInstance方法，如下所示<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> Log <span class="title">getInstance</span><span class="params">(String name)</span> <span class="keyword">throws</span> LogConfigurationException </span>&#123;</span><br><span class="line">    Log instance = (Log) instances.get(name);</span><br><span class="line">    <span class="keyword">if</span> (instance == <span class="keyword">null</span>) &#123;</span><br><span class="line">        instance = newInstance(name);</span><br><span class="line">        instances.put(name, instance);</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> instance;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>　　在上面的方法中，最重要的则为newInstance方法，该方法内调用了discoverLogImplementation方法，下面我直接进入discoverLogImplementation方法，其关键代码如下：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">0</span>; i&lt;classesToDiscover.length &amp;&amp; result == <span class="keyword">null</span>; ++i) &#123;</span><br><span class="line">    result = createLogFromClass(classesToDiscover[i], logCategory, <span class="keyword">true</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>而数组classesToDiscover的定义如下；<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String[] classesToDiscover = &#123;</span><br><span class="line">        LOGGING_IMPL_LOG4J_LOGGER,　<span class="comment">/*LOGGING_IMPL_LOG4J_LOGGER = org.apache.commons.logging.impl.Log4JLogger;*/</span></span><br><span class="line">        <span class="string">"org.apache.commons.logging.impl.Jdk14Logger"</span>,</span><br><span class="line">        <span class="string">"org.apache.commons.logging.impl.Jdk13LumberjackLogger"</span>,</span><br><span class="line">        <span class="string">"org.apache.commons.logging.impl.SimpleLog"</span></span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure></p>
<p>　　可以看到，Log接口优先使用Log4JLogger实现，接着是Jdk14Logger、Jdk13LumberjackLogger，最后为SimpleLog。在Log4JLogger中存在一个静态代码块，如下所示，其中类Priority、Level等均为log4j包中的类，由于未引入log4j的包，导致首次循环调用createLogFromClass方法时，初始化失败，返回null。进入下一次循环，采用Jdk14Logger的实现。初始化成功，所以测试程序中打印的为org.apache.commons.logging.impl.Jdk14Logger@1310c2e8<br><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">static</span> &#123;</span><br><span class="line">    <span class="keyword">if</span> (!Priority.class.isAssignableFrom(Level.class)) &#123;</span><br><span class="line">        <span class="comment">// nope, this is log4j 1.3, so force an ExceptionInInitializerError</span></span><br><span class="line">        <span class="keyword">throw</span> <span class="keyword">new</span> InstantiationError(<span class="string">"Log4J 1.2 not available"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    Priority _traceLevel;</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        _traceLevel = (Priority) Level.class.getDeclaredField(<span class="string">"TRACE"</span>).get(<span class="keyword">null</span>);</span><br><span class="line">    &#125; <span class="keyword">catch</span>(Exception ex) &#123;</span><br><span class="line">        <span class="comment">// ok, trace not available</span></span><br><span class="line">        _traceLevel = Level.DEBUG;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="comment">//默认为trace级别</span></span><br><span class="line">    traceLevel = _traceLevel;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>　　从上面的分析可以看出，commons-logging默认采用的日志实现框架，优先级依次为：Log4JLogger、Jdk14Logger、Jdk13LumberjackLogger和SimpleLog。</p>
<h2 id="u63A5_u5165log4j"><a href="#u63A5_u5165log4j" class="headerlink" title="接入log4j"></a>接入log4j</h2><p>　　首先我们引入log4j包，如下。<br><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="title">dependency</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">groupId</span>&gt;</span>log4j<span class="tag">&lt;/<span class="title">groupId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">artifactId</span>&gt;</span>log4j<span class="tag">&lt;/<span class="title">artifactId</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="title">version</span>&gt;</span>1.2.17<span class="tag">&lt;/<span class="title">version</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="title">dependency</span>&gt;</span></span><br></pre></td></tr></table></figure></p>
<p>　　运行程序，结果如下，可以看到，此时<strong>提示没有找到log4j的配置文件</strong>，故没有输出任何日志信息，后面几篇文章我们再介绍log4j<br>org.apache.commons.logging.impl.Log4JLogger@49c1e1e7<br>log4j:WARN No appenders could be found for logger (Demo).<br>log4j:WARN Please initialize the log4j system properly.<br>log4j:WARN See <a href="http://logging.apache.org/log4j/1.2/faq.html#noconfig" target="_blank" rel="external">http://logging.apache.org/log4j/1.2/faq.html#noconfig</a> for more info.</p>
<h2 id="u4F7F_u7528SimpleLog"><a href="#u4F7F_u7528SimpleLog" class="headerlink" title="使用SimpleLog"></a>使用SimpleLog</h2><p>　　simpleLog为commons-logging中实现的一个向控制台数据的类。先增加配置文件commons-logging.properties，并增加内容：org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog，此时测试输出结果如下：<br>　　org.apache.commons.logging.impl.SimpleLog@39242445<br>　　[INFO] Demo - info信息<br>　　[WARN] Demo - warn信息<br>　　[ERROR] Demo - error信息<br>　　[FATAL] Demo - </p>
<p>　　可以看到，当我们在配置文件中指定了Log类型后，则会覆盖默认的优先使用顺序：Log4JLogger、Jdk14Logger、Jdk13LumberjackLogger、SimpleLog。直接采用配置文件中指定的Log类型。</p>
<h2 id="LogFactory"><a href="#LogFactory" class="headerlink" title="LogFactory"></a>LogFactory</h2><p>　　上面的示例都是通过LogFactory获取的。那么，LogFactory有哪些功能呢？首先，LogFactory是一个抽象类，在初始化的时候，其会在getFactory()方法中寻找具体的实现类，下面直接列出结果：<br>　　1. 根据类加载器，找到通过该加载器加载的LogFactory实例（通过key-value的形式存放在Hashtable中），找到则直接返回，否则进入第下步<br>　　2. 从System Property中查找LogFactory，如果没找到，则进入下一步，否则直接到最后一步。<br>　　3. 从文件META-INF/services/org.apache.commons.logging.LogFactory中查找（类似于java SPI机制，），如果没找到，则进入下一步，找到则直接到最后一步。<br>　　4. 从commons-loggging.properties配置文件中查找配置org.apache.commons.logging.LogFactory配置，如果没找到，则进入下一步，否则直接到最后一步。<br>　　5. 采用默认的实现org.apache.commons.logging.impl.LogFactoryImpl，到最后一步。<br>　　6. 初始化完成后，放入第一步提到的Hashtable中缓存，最后返回。</p>
<h2 id="u6269_u5C55"><a href="#u6269_u5C55" class="headerlink" title="扩展"></a>扩展</h2><p>　　在commons-logging配置文件、或虚拟机属性中配置这个新的Logging框架的实现类（实现Log接口）</p>
<h2 id="u603B_u7ED3"><a href="#u603B_u7ED3" class="headerlink" title="总结"></a>总结</h2><p>　　通过上面的分析可以看出，commons-logging仅仅是一个日志框架的基石，提供了统一的使用接口。如果需要打印输出日志，则需要借助于log4j，jdk log等具体的实现，或者采用其自身提供的SimpleLog，向控制台打印输出。同时，也没有提供配置属性执行日志级别，好奇怪！源码下载地址为：<a href="/code/commons-logging-demo.rar">commons-logging-demo.rar</a></p>
<h2 id="u53C2_u8003_u8D44_u6599"><a href="#u53C2_u8003_u8D44_u6599" class="headerlink" title="参考资料"></a>参考资料</h2><p><a href="http://www.cnblogs.com/machine/archive/2012/12/17/2822227.html" target="_blank" rel="external">http://www.cnblogs.com/machine/archive/2012/12/17/2822227.html</a><br><a href="http://zhangjunhd.blog.51cto.com/113473/25135/" target="_blank" rel="external">http://zhangjunhd.blog.51cto.com/113473/25135/</a><br><a href="http://blog.csdn.net/gxmark/article/details/7338253" target="_blank" rel="external">http://blog.csdn.net/gxmark/article/details/7338253</a><br><a href="http://pangwu86.iteye.com/blog/1122082" target="_blank" rel="external">http://pangwu86.iteye.com/blog/1122082</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/12/15/log/1.日志系列之commons-logging/" data-id="cijzzpvch00bd1cfsbdw22evg" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/common-loggings/">common-loggings</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/log/">log</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2015/12/15/log/2.日志系列之slf4j/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          日志系列二之slf4j
        
      </div>
    </a>
  
  
    <a href="/2015/12/11/redis/6.Redis系列之发布-订阅模式/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">Redis系列五之发布-订阅模式</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/cache/">cache</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a><span class="category-list-count">13</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/docker/">docker</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/gis/">gis</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/go/">go</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/gradle/">gradle</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/groovy/">groovy</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hadoop/">hadoop</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/java/">java</a><span class="category-list-count">18</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/log/">log</a><span class="category-list-count">11</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mongodb/">mongodb</a><span class="category-list-count">14</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mq/">mq</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mybatis/">mybatis</a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/netty/">netty</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nginx/">nginx</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nio/">nio</a><span class="category-list-count">19</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nodejs/">nodejs</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/redis/">redis</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/rpc/">rpc</a><span class="category-list-count">14</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/spring/">spring</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/tomcat/">tomcat</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/zookeeper/">zookeeper</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/杂项/">杂项</a><span class="category-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/aop/">aop</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/aspectj/">aspectj</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/classloader/">classloader</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/common-loggings/">common-loggings</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/commonjs/">commonjs</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a><span class="tag-list-count">10</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/">docker</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dubbo/">dubbo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/fastdfs/">fastdfs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gclib/">gclib</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/geohash/">geohash</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gis/">gis</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/go/">go</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gradle/">gradle</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/groovy/">groovy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hadoop/">hadoop</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hessisan/">hessisan</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a><span class="tag-list-count">48</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javassist/">javassist</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kafka/">kafka</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/log/">log</a><span class="tag-list-count">11</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/log4j/">log4j</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/logback/">logback</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/map/">map</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memecached/">memecached</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mina/">mina</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mongodb/">mongodb</a><span class="tag-list-count">14</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mq/">mq</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mqtt/">mqtt</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mybatis/">mybatis</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netty/">netty</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/">nginx</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nio/">nio</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nodejs/">nodejs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/postgresql/">postgresql</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/proxy/">proxy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/push/">push</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rabbitmq/">rabbitmq</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/redis/">redis</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rpc/">rpc</a><span class="tag-list-count">14</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sitemesh/">sitemesh</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sld/">sld</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/slf4j/">slf4j</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/socket/">socket</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spatialite-for-android/">spatialite for android</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spi/">spi</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spring/">spring</a><span class="tag-list-count">13</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tomcat/">tomcat</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/transaction/">transaction</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/web/">web</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xSocket/">xSocket</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zbus/">zbus</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zookeeper/">zookeeper</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/数据结构/">数据结构</a><span class="tag-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/aop/" style="font-size: 15.38px;">aop</a> <a href="/tags/aspectj/" style="font-size: 11.54px;">aspectj</a> <a href="/tags/cache/" style="font-size: 11.54px;">cache</a> <a href="/tags/classloader/" style="font-size: 10px;">classloader</a> <a href="/tags/common-loggings/" style="font-size: 10px;">common-loggings</a> <a href="/tags/commonjs/" style="font-size: 12.31px;">commonjs</a> <a href="/tags/database/" style="font-size: 16.92px;">database</a> <a href="/tags/docker/" style="font-size: 13.85px;">docker</a> <a href="/tags/dubbo/" style="font-size: 10px;">dubbo</a> <a href="/tags/fastdfs/" style="font-size: 10px;">fastdfs</a> <a href="/tags/gclib/" style="font-size: 10.77px;">gclib</a> <a href="/tags/geohash/" style="font-size: 10px;">geohash</a> <a href="/tags/gis/" style="font-size: 10px;">gis</a> <a href="/tags/git/" style="font-size: 10.77px;">git</a> <a href="/tags/go/" style="font-size: 10px;">go</a> <a href="/tags/gradle/" style="font-size: 10px;">gradle</a> <a href="/tags/groovy/" style="font-size: 10px;">groovy</a> <a href="/tags/hadoop/" style="font-size: 10px;">hadoop</a> <a href="/tags/hessisan/" style="font-size: 11.54px;">hessisan</a> <a href="/tags/java/" style="font-size: 20px;">java</a> <a href="/tags/javassist/" style="font-size: 10px;">javassist</a> <a href="/tags/kafka/" style="font-size: 11.54px;">kafka</a> <a href="/tags/linux/" style="font-size: 12.31px;">linux</a> <a href="/tags/log/" style="font-size: 17.69px;">log</a> <a href="/tags/log4j/" style="font-size: 12.31px;">log4j</a> <a href="/tags/logback/" style="font-size: 13.08px;">logback</a> <a href="/tags/map/" style="font-size: 10px;">map</a> <a href="/tags/memecached/" style="font-size: 10.77px;">memecached</a> <a href="/tags/mina/" style="font-size: 13.08px;">mina</a> <a href="/tags/mongodb/" style="font-size: 19.23px;">mongodb</a> <a href="/tags/mq/" style="font-size: 13.85px;">mq</a> <a href="/tags/mqtt/" style="font-size: 10.77px;">mqtt</a> <a href="/tags/mybatis/" style="font-size: 16.15px;">mybatis</a> <a href="/tags/netty/" style="font-size: 10px;">netty</a> <a href="/tags/nginx/" style="font-size: 11.54px;">nginx</a> <a href="/tags/nio/" style="font-size: 13.08px;">nio</a> <a href="/tags/nodejs/" style="font-size: 10px;">nodejs</a> <a href="/tags/postgresql/" style="font-size: 10.77px;">postgresql</a> <a href="/tags/protobuf/" style="font-size: 10px;">protobuf</a> <a href="/tags/proxy/" style="font-size: 10px;">proxy</a> <a href="/tags/push/" style="font-size: 10px;">push</a> <a href="/tags/rabbitmq/" style="font-size: 11.54px;">rabbitmq</a> <a href="/tags/redis/" style="font-size: 13.85px;">redis</a> <a href="/tags/rpc/" style="font-size: 19.23px;">rpc</a> <a href="/tags/sitemesh/" style="font-size: 10px;">sitemesh</a> <a href="/tags/sld/" style="font-size: 10px;">sld</a> <a href="/tags/slf4j/" style="font-size: 10px;">slf4j</a> <a href="/tags/socket/" style="font-size: 14.62px;">socket</a> <a href="/tags/spatialite-for-android/" style="font-size: 10px;">spatialite for android</a> <a href="/tags/spi/" style="font-size: 10px;">spi</a> <a href="/tags/spring/" style="font-size: 18.46px;">spring</a> <a href="/tags/tomcat/" style="font-size: 10.77px;">tomcat</a> <a href="/tags/transaction/" style="font-size: 10px;">transaction</a> <a href="/tags/web/" style="font-size: 10px;">web</a> <a href="/tags/xSocket/" style="font-size: 14.62px;">xSocket</a> <a href="/tags/zbus/" style="font-size: 10px;">zbus</a> <a href="/tags/zookeeper/" style="font-size: 10.77px;">zookeeper</a> <a href="/tags/数据结构/" style="font-size: 10.77px;">数据结构</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a><span class="archive-list-count">67</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">December 2015</a><span class="archive-list-count">81</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a><span class="archive-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/01/30/资料/">(no title)</a>
          </li>
        
          <li>
            <a href="/2016/01/30/java/13.Classloader系列一/">ClassLoader系列一</a>
          </li>
        
          <li>
            <a href="/2016/01/29/hadoop/1.hadoop系列之源码编译/">hadoop系列一之源码编译</a>
          </li>
        
          <li>
            <a href="/2016/01/29/go/1.GO系列之入门/">Go系列一之入门</a>
          </li>
        
          <li>
            <a href="/2016/01/28/tomcat/2.tomcat性能优化/">tomcat性能优化</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
  <script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>


<script src="/js/script.js" type="text/javascript"></script>

  </div>
</body>
</html>